<?php
/* 
 * Автозагрузчик Шаблонов
 */

class Anderles_Layouts_Loader extends Zend_Controller_Action_Helper_Abstract {

  public function  preDispatch() {
    $bootstrap = $this->getActionController()->getInvokeArg('bootstrap');
    $config = $bootstrap->getOptions();
    $module = $this->getRequest()->getModuleName();

    if(isset($config[$module]['resources']['layout']['layout'])) {
      $layoutScript = $config[$module]['resources']['layout']['layout'];
      $this->getActionController()->getHelper('layout')->setLayout($layoutScript);
    }
  }
}
